﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Threading;
using System.Threading.Tasks;

namespace YellowMap.View.Page
{
    public partial class SplashPage : PhoneApplicationPage
    {
        DispatcherTimer timer = new DispatcherTimer();
        public SplashPage()
        {
            InitializeComponent();
            SplashScreen();
           
        }

        async void SplashScreen()
        {
            await Task.Delay(new TimeSpan(0,0,0,2), System.Threading.CancellationToken.None);
            NavigationService.Navigate(new Uri(@"/MainPage.xaml", UriKind.Relative));
            //NavigationService.RemoveBackEntry();
        }

        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            //base.OnBackKeyPress(e);
            Application.Current.Terminate();
        }
        //void timer_Tick(object sender, EventArgs e)
        //{
        //    timer.Stop();
        //    NavigationService.Navigate(new Uri(@"/MainPage.xaml", UriKind.Relative));
        //    NavigationService.RemoveBackEntry();
        //}
    }
}